package com.grad.why.studentsystem.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.grad.why.studentsystem.domain.Indexweights;
import com.grad.why.studentsystem.mapper.IndexinfosMapper;
import com.grad.why.studentsystem.mapper.IndexweightsMapper;
import com.grad.why.studentsystem.service.IndexInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(interfaceClass = IndexInfoService.class)
@Component
@Transactional
public class IndexInfoServiceImpl implements IndexInfoService {
    @Autowired
    private IndexinfosMapper indexinfosMapper;

    @Autowired
    private IndexweightsMapper indexweightsMapper;

    @Override
    public int getFirstIndexCountByProjectId(int projectid) {
        try{
            return indexinfosMapper.getFirstIndexCountByProjectId(projectid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public int getSecondIndexCountByProjectId(int projectid) {
        try{
            return indexinfosMapper.getSecondIndexCountByProjectId(projectid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public List<Indexweights> getIndexWeightByProjectId(int projectid) {
        try{
            return indexweightsMapper.getIndexWeightByProjectId(projectid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
